package pers.archives.loginToken.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;

import java.util.List;

/*
 *@program:archives-parent
 *@author: 赵浩浩
 *@Time: 2020/9/26  10:16
 */
@Component
public class ArchivesAuthorizeConfigManager implements AuthorizeConfigManager{

    @Autowired
    private List<AuthorizeConfigProvider> authorizeConfigProviders;

    @Override
    public void config(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
        //设置不需要进行身份认证的url
        for (AuthorizeConfigProvider p : authorizeConfigProviders) {
            p.config(config);
        }
        //都需要进行身份认证
        config.anyRequest().authenticated();
    }
}
